
<div style="width:360px;padding: 20px 0px;">
	<form action="__SELF__" method="post" class="filter">
	<div class="form_data">
		<div class="mod_data">
			<div class="name">类别名称</div>
			<div class="input_data" style="width: 200px;">
				<input type="text" name="title" value="{$info['title']}" datatype="*" ajaxurl="{:URL('valid_field',array('fileds'=>'module','value'=>$type))}" style="width: 150px">
			</div>
		</div>
		<div class="mod_submit">
			<input type="hidden" name="module" value="{$type}" />
			<button type="button" class="btn btn-add ajax_win">添加</button>
			<button type="button" class="btn btn-cancel" onclick="$.winRemove();">关闭</button>
		</div>
	</div>
	</form>
</div>
<script type="text/javascript">
$(document).ready(function(){
	var form_valid = $("#winBodyContainer form").Validform({
		tiptype:3,
		label:".name",
		showAllError:true
	});
	$("form .ajax_win").click(function () {
		//验证表单是否能提交(实时验证会被跳过BUG)
		if(form_valid.check() == false){return false;}
		data = $("#winBodyContainer form").serialize();
		url  = $("#winBodyContainer form").attr('action');
		loading('正在添加中...');
		$.ajax({
			type: "POST",
			url: url,
			data: data,
			dataType: "json",
			success: function(data){
				removeLoading();
				if(data.status == 1){
					msgbox(data.info);
					html = '<option value="'+data.data.add_id+'">'+data.data.add_name+'</option>';
					$("select[name='{$category_field}']").append(html);
					$("select[name='{$category_field}']").val(data.data.add_id);
				}else{
					msgbox(data.info, 'error');
				}
				$.winRemove();
			}
		});
		return false;
	});
	//处理回车自动提交表单问题
	$("#winBodyContainer form").submit(function () {
		return false;
	});
});
</script>